package mp1.service;

import mp1.entity.Product;
import mp1.entity.Supplier;
import mp1.exception.ProductAdminException;
import mp1.mapper.SupplierMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class SupplierService {

    @Autowired
    SupplierMapper supplierMapper;

    public void addSup(Supplier supplier){
        supplierMapper.insert(supplier);
    }

    public void deleteSupById(Long id){
        supplierMapper.deleteById(id);
    }

    public Supplier findSupById(Long id){
        return supplierMapper.selectById(id);
    }

    public void updateSup(Supplier supplier){
        supplierMapper.updateById(supplier);
    }

    public List<Supplier> findSupByPro(String proName){
        return supplierMapper.findProByPro(proName);
    }

}
